#include<iostream>
#include<vector>
using namespace std;
//[0,1,2,3,4,2,2,3,3,4]
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int i=0,j=1,len=nums.size();
        for(;j<len;j++)
        {
            if(nums[i]!=nums[j])
                nums[++i]=nums[j];
        }
        return ++i;
    }
};